function Ankhy_Priest_1()
	ccRS.Auto_Facing = false
	-- Mindbender 
	local vTalent = {GetTalentInfo(8)}
	local vGotMindbender = false
	if vTalent[6] == true then vGotMindbender = true else vGotMindbender = false end
	----------------------
	-- Cast Power Word: Fortitude
	ccrCastBuffIfMissing("Power Word: Fortitude")
	 ---------------------
	 -- Cast Inner Fire
	ccrCastBuffIfMissing("Inner Fire")
	 ---------------------
	 ccrCastBuffIfMissing("Inner Focus")

	--------------------------
	-- Find all nearby players
	Gather_Nearby_Players()
	--------------------------
	-- Autoaccept LFR invite
	AcceptProposal();
	--------------------------
	-- Find who has the lowest health
	local vPlayerToHeal, vPlayerHealth = Find_Lowest_HP()
	if vPlayerToHeal ~= nil
	and vPlayerHealth ~= nil
	then
		-- Raid Specific
		if ccrUnitHasDebuff(vPlayerToHeal, "Strong Ancient Barrier", "any") then vPlayerHealth = 100 end
		if ccrUnitHasDebuff(vPlayerToHeal, "Ancient Barrier", "any") then vPlayerHealth = 80 end
		if ccrUnitHasDebuff(vPlayerToHeal, "Weak Ancient Barrier", "any") then vPlayerHealth = 50 end

		
		if ccrTargetName() == "Thok the Bloodthirsty" and ccrTargetIsCastingSpell("Deafening Screech")
			and not ccrUnitHasBuff(vPlayerToHeal, "Power Word: Shield") and not ccrUnitHasBuff(vPlayerToHeal, "Weakened Soul")
			and SpellIsReady("Power Word: Shield")
			then if not ccrPlayerHasBuff("Devotion Aura") then
				SpellStopCasting() end
				ccrCast("Power Word: Shield", vPlayerToHeal)
				return
		end		
		if ccrTargetName() == "Thok the Bloodthirsty" and ccrTargetIsCastingSpell("Deafening Screech") and not ccrPlayerHasBuff("Devotion Aura")
				then
				SpellStopCasting()
				return
			else

		
		 if IsShiftKeyDown() then 
				ccrCast("Power Word: Barrier")
				CameraOrSelectOrMoveStart()
				CameraOrSelectOrMoveStop()
			return
		end
		-- Wait until casting is over 
		if ccrPlayerIsCastingOrChanneling() then return end
		--
		
		-- Dispel
		if SpellIsReady("Purify") then
			if ccrUnitHasDebuffStacks(vPlayerToHeal, "Shadow Word: Bane", 2, "any")
			or ccrUnitHasDebuff(vPlayerToHeal, "Self-Absorbed")
			or ccrUnitHasDebuffStacks(vPlayerToHeal, "Corrosive Blood", 1, "any")
			then
				ccrCast("Purify", vPlayerToHeal)
			end
		end
		local vPlayerWithDebuff = ccrFindDebuffInGroup("Mark of Arrogance")
		if vPlayerWithDebuff ~= nil
			and ccrPlayerHasDebuff("Gift of the Titans")
			and ccrSpellIsReady("Purify")
			then
				ccrCast("Purify", vPlayerWithDebuff)
		return
		end
		if vPlayerWithDebuff ~= nil
			and ccrTargetName() == "Sha of Pride"
			and ccrTargetHealth() <= 30
			and ccrSpellIsReady("Purify")
			then
				ccrCast("Purify", vPlayerWithDebuff)
		return
		end
		local vPlayerWithDebuffBane = ccrFindDebuffInGroup("Shadow Word: Bane")
		if vPlayerWithDebuffBane ~= nil
			and ccrPlayerHasBuff("Lucidity")
			and ccrSpellIsReady("Mass Dispel")
			and #tblGroupedPlayersHealth > 0
			then
				ccrCast("Mass Dispel", vPlayerWithDebuffBane)
				if SpellIsTargeting() == 1 then CastAtLocation(GetAveragePositionOfObjects(tblGroupedPlayersHealth)) end
			return
		end
		local vPlayerWithDebuffBlood = ccrFindDebuffInGroup("Corrosive Blood")
		if vPlayerWithDebuffBlood ~= nil and ccrTargetName("Thok the Bloodthirsty")
			and ccrPlayerHasBuff("Lucidity")
			and ccrSpellIsReady("Mass Dispel")
			and #tblGroupedPlayersHealth > 0
			then
				ccrCast("Mass Dispel", vPlayerWithDebuffBlood)
				if SpellIsTargeting() == 1 then CastAtLocation(GetAveragePositionOfObjects(tblGroupedPlayersHealth)) end
			return
		end
				-- Prayer of Healing for Spirit Shell
	--[[	if ccrPlayerHasBuff(109964) 
		and not ccrPlayerIsMoving()
		and not ccrUnitHasBuff(vPlayerToHeal, 114908)
		then 
		    ccrCast("Prayer of Healing", vPlayerToHeal)
			return
		else --]]
		
	    --------------------------------- Heroic SOO
		--------------------------------- Mana \ Survival \ CD
		-- Mindbender
		if vGotMindbender 
		    and ccrPlayerMana() <= 90
		    and SpellIsReady("Shadowfiend")
		    then
		        ccrCast("Shadowfiend")
		    else	
		
		    -- Shadowfiend
			if ccrPlayerMana() <= 80
		    and SpellIsReady("Shadowfiend")
		    then
		        ccrCast("Shadowfiend")
		    end	
		end
		
		-- Desperate Prayer
		if ccrPlayerHealth() <= 30
		and SpellIsReady("Desperate Prayer")
		then
			ccrCast("Desperate Prayer") 
		end	
		
        -- Angelic Feather
		if IsMounted() == nil
		and not ccrPlayerIsInCombat()
		and SpellIsReady("Angelic Feather")
		and not ccrPlayerHasBuff("Angelic Feather")
		and ccrPlayerIsMoving()
		then
			ccrCast("Angelic Feather")
			if SpellIsTargeting() == 1 then CastAtLocation(Player:GetLocation()) end
			return
		end
		
		-- Archangel
		if SpellIsReady("Archangel") then ccrCast("Archangel") end
		-- Inner Focus
		if SpellIsReady("Inner Focus") then ccrCast("Inner Focus") end 
		
		--------------------------------- Emergency Heal
		-- Void Shift
		if vPlayerHealth <= 20
		and ccrPlayerHealth() > 70
		and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
		and not ccrPlayerIsMoving()
		then
			SpellStopCasting()
		    ccrCast("Void Shift", vPlayerToHeal)
			return
		end
		-- Flash heal on tank at 35%
		if vPlayerHealth <= 30
		and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
		and not ccrPlayerIsMoving()
		then
		    ccrCast("Flash Heal", vPlayerToHeal)
			return
		end
		
		-- Binding Heal on tank at 30% and player 80%
		if vPlayerHealth <= 30
		and ccrPlayerHealth() <= 80
		and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
		and not ccrPlayerIsMoving()
		then
		    ccrCast("Binding Heal", vPlayerToHeal)
			return
		end
		
		--------------------------------- LMG procs \ Tank and raidhealing
		
		-- Binding heal with LMG proc
		if ccrPlayerHasBuff("Lucidity")
			and ccrPlayerHasBuffRemaining("Lucidity", 1.5)
			and vPlayerHealth <= 80
			and ccrPlayerHealth() <= 90
			and not ccrPlayerIsMoving()
			then
		    ccrCast("Binding Heal", vPlayerToHeal)
			return
		end
		
		-- Tier 6 
		
		   -- Cascade with LMG proc

		    if ccrPlayerHasBuff("Lucidity")
		    and SpellIsReady("Cascade")
		    then
		       ccrCast("Cascade", vPlayerToHeal)
			   return
			end

		       -- Cascade at 5 x 85%
		if GroupedPlayersHealth(vPlayerToHeal, 20, 85) >= 5 then
		if SpellIsReady("Cascade")
		then
			ccrCast("Cascade", vPlayerToHeal)
			return
		    end
        end     
		
		    -- Divine Star with LMG proc
		if ccrPlayerHasBuff("Lucidity")
            and SpellIsReady("Divine Star")
            then
				SpellStopCasting()
                ccrCast("Divine Star")
				return
		end
		    -- Divine Star at 4 x 87%
	    if GroupedPlayersHealth(vPlayerToHeal, 20, 90) >= 3 then
	    if SpellIsReady("Divine Star")
	    then
			SpellStopCasting()
			ccrCast("Divine Star")
			return
			end
	    end	
		
		   -- Halo with LMG proc

            if ccrPlayerHasBuff("Lucidity")
            and SpellIsReady("Halo")
            then
                ccrCast("Halo")
				return
            end

		   -- Halo
		if GroupedPlayersHealth(vPlayerToHeal, 20, 70) >= 8 then
		if SpellIsReady("Halo")
		then
			ccrCast("Halo")
			return
			end
	    end	
		   
		   
		-- Prayer of Healing for Spirit Shell
		for i = 0, # tblNearbyPlayers do
			if ccrPlayerHasBuff(109964) 
			and not ccrPlayerIsMoving()
			and not ccrUnitHasBuff(tblNearbyPlayers[i], "Spiri Shell")
			then 
				ccrCast("Prayer of Healing", tblNearbyPlayers[i])
				return
			end
		end	
		
		
		-- Prayer of Healing with Inner Focus
		if ccrPlayerHasBuff("Inner Focus") 
		and not ccrPlayerIsMoving()
		and GroupedPlayersHealth(vPlayerToHeal, 20, 99) >= 4 then
	    if SpellIsReady("Prayer of Healing") 
		    then ccrCast("Prayer of Healing", vPlayerToHeal) 
			return
			end
		end	
		
		-- Prayer of Healing
		if GroupedPlayersHealth(vPlayerToHeal, 20, 85) >= 5 
		and not ccrPlayerIsMoving()
		then
	        ccrCast("Prayer of Healing", vPlayerToHeal)
           	return	   
		end
		
		-- Power Word: Shield on tanks, when LMG proc for free rupture
		if vPlayerHealth <= 100
		and ccrPlayerHasBuff("Lucidity")
		and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
		then
			if not ccrUnitHasBuff(vPlayerToHeal, "Power Word: Shield") and not ccrUnitHasBuff(vPlayerToHeal, "Weakened Soul")
			and SpellIsReady("Power Word: Shield")
			then
				ccrCast("Power Word: Shield", vPlayerToHeal)
				return
		    end
		end
		
		-- Prayer of Mending on tank when LMG proc
		if vPlayerHealth <= 100
		and ccrPlayerHasBuff("Lucidity")
		and SpellIsReady("Prayer of Mending")
		and UnitGroupRolesAssigned(vPlayerToHeal) == "TANK"
		then
		    ccrCast("Prayer of Mending", vPlayerToHeal)
			return
		end	
		
		
		-- Heal when mana under 20%
		if vPlayerHealth <= 90
		and not ccrPlayerIsMoving()
		and ccrPlayerMana() <= 20
		then
	        ccrCast("Heal", vPlayerToHeal)
           	return	   
		end
		
        --------------------------------- Attonement Healing
		--------------------------------- Solo DPS
		-- Shadow Word: Death
		if ccrTargetHealth() <= 20
		and SpellCanAttack("Shadow Word: Death")
		and ccrPlayerIsInCombat()
		and not IsInRaid()
		then
			ccrCastAttack("Shadow Word: Death")
			return
		else
		    -- Shadow Word: Pain
		    if not ccrTargetHasDebuff("Shadow Word: Pain")
		    and SpellCanAttack("Shadow Word: Pain")
		    and ccrPlayerIsInCombat()
			and not IsInRaid()
		    then
			    ccrCastAttack("Shadow Word: Pain")
			    return
		    else
        --------------------------------- Solo DPS			
						   -- Holy Fire
							if not ccrTargetHasDebuff("Holy Fire")
							and SpellCanAttack("Holy Fire")
							and ccrPlayerMana() >= 20
							and ccrPlayerIsInCombat()
							then
								StopIfCasting("Smite", 1)
								ccrCastAttack("Holy Fire")
								return
							else
								-- Penance
								if SpellCanAttack("Penance")
								and ccrPlayerMana() >= 20
								and ccrPlayerIsInCombat()		
								then
									StopIfCasting("Smite", 1)
									ccrCastAttack("Penance")
									return
								else
									-- Smite
									if SpellCanAttack("Smite")
									and ccrPlayerIsInCombat()
									and ccrPlayerMana() >= 20				
									and not ccrPlayerIsMoving() 
									then ccrCastAttack("Smite") 
									return
								end	
							end
						end	
			        end
			    end
		    end
		end
    end
	